package com.ssy.lingxi.settle.accounts.model.vo.response;

import com.ssy.lingxi.dto.model.constant.ApplyAmountRowBillTypeEnum;
import com.ssy.lingxi.settle.accounts.model.constant.ApplyAmountTypeEnum;
import com.ssy.lingxi.settle.accounts.model.constant.SettleAccountsServiceContants;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 待对账单列表VO
 * @author Saske
 * @date 2021/12/6
 * @version 2.0.0
 */
public class ToBeReconciliationVO implements Serializable {

    private static final long serialVersionUID = -8883960826249570038L;

    public ToBeReconciliationVO(
                                Long id,
                                Long billId,
                                String billNo,
                                String payer,
                                Long buyerMemberId,
                                Long buyerRoleId,
                                Integer deliveryBatch,
                                String deliveryNo,
                                LocalDateTime deliveryTime,
                                String receiveNo,
                                LocalDateTime receiveTime,
                                String orderStatus,
                                Integer orderType,
                                Integer billType,
                                LocalDateTime billDate,
                                BigDecimal billAmount,
                                String billAbstract,
                                Long sourceContractId,
                                List<ToBeReconciliationRowVO> products) {
        this.id = id;
        this.billId = billId;
        this.billNo = billNo;
        this.payer = payer;
        this.buyerMemberId = buyerMemberId;
        this.buyerRoleId = buyerRoleId;
        this.deliveryBatch = deliveryBatch+"";
        this.deliveryNo = deliveryNo;
        this.deliveryTime = deliveryTime.format(SettleAccountsServiceContants.DEFAULT_TIME_FORMATTER);
        this.receiveNo = receiveNo;
        this.receiveTime = receiveTime.format(SettleAccountsServiceContants.DEFAULT_TIME_FORMATTER);
        this.orderStatus = orderStatus;
        this.orderType = orderType;
        this.orderTypeName = billType.equals(ApplyAmountRowBillTypeEnum.RETURN_REQUEST.getCode()) ? "--" : ApplyAmountTypeEnum.getNameByCode(orderType);
        this.billType = billType;
        this.billTypeName = ApplyAmountRowBillTypeEnum.getNameByCode(billType);
        this.billDate = billDate.format(SettleAccountsServiceContants.DEFAULT_DATE_FORMATTER);
        this.billAmount = billAmount;
        this.billAbstract = billAbstract;
        this.sourceContractId = sourceContractId;
        this.products = CollectionUtils.isEmpty(products) ? new ArrayList<>() : products;
    }

    /**
     * id
     */
    private Long id;
    /**
     * 订单id
     */
    private Long billId;

    /**
     * 订单号 （字符集 utf-8）
     */
    private String billNo;

    /**
     * 付款方 （字符集 utf-8）
     */
    private String payer;

    /**
     * 买方（采购）会员Id
     */
    private Long buyerMemberId;

    /**
     * 买方（采购）会员角色Id
     */
    private Long buyerRoleId;

    /**
     * 发货批次
     */
    private String deliveryBatch;

    /**
     * 发货单号
     */
    private String deliveryNo;

    /**
     * 发货时间
     */
    private String deliveryTime;

    /**
     * 收货单号
     */
    private String receiveNo;

    /**
     * 收货时间
     */
    private String receiveTime;

    /**
     * 订单状态
     */
    private String orderStatus;

    /**
     * 订单类型
     */
    private Integer orderType;

    /**
     * 订单类型名称
     */
    private String orderTypeName;

    /**
     * 单据类型
     * 定义：ApplyAmountRowBillTypeEnum
     */
    private Integer billType;

    /**
     * 单据类型名称
     */
    private String billTypeName;

    /**
     * 单据日期
     */
    private String billDate;

    /**
     * 单据总金额
     */
    private BigDecimal billAmount;

    /**
     * 单据摘要
     */
    private String billAbstract;

    /**
     * 来源合同id
     */
    private Long sourceContractId;

    /**
     * 待对账单列表行信息VO
     */
    private List<ToBeReconciliationRowVO> products;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getBillId() {
        return billId;
    }

    public void setBillId(Long billId) {
        this.billId = billId;
    }

    public String getBillNo() {
        return billNo;
    }

    public void setBillNo(String billNo) {
        this.billNo = billNo;
    }

    public String getPayer() {
        return payer;
    }

    public void setPayer(String payer) {
        this.payer = payer;
    }

    public Long getBuyerMemberId() {
        return buyerMemberId;
    }

    public void setBuyerMemberId(Long buyerMemberId) {
        this.buyerMemberId = buyerMemberId;
    }

    public Long getBuyerRoleId() {
        return buyerRoleId;
    }

    public void setBuyerRoleId(Long buyerRoleId) {
        this.buyerRoleId = buyerRoleId;
    }

    public String getDeliveryBatch() {
        return deliveryBatch;
    }

    public void setDeliveryBatch(String deliveryBatch) {
        this.deliveryBatch = deliveryBatch;
    }

    public String getDeliveryNo() {
        return deliveryNo;
    }

    public void setDeliveryNo(String deliveryNo) {
        this.deliveryNo = deliveryNo;
    }

    public String getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(String deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    public String getReceiveNo() {
        return receiveNo;
    }

    public void setReceiveNo(String receiveNo) {
        this.receiveNo = receiveNo;
    }

    public String getReceiveTime() {
        return receiveTime;
    }

    public void setReceiveTime(String receiveTime) {
        this.receiveTime = receiveTime;
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Integer getBillType() {
        return billType;
    }

    public void setBillType(Integer billType) {
        this.billType = billType;
    }

    public List<ToBeReconciliationRowVO> getProducts() {
        return products;
    }

    public void setProducts(List<ToBeReconciliationRowVO> products) {
        this.products = products;
    }

    public String getBillDate() {
        return billDate;
    }

    public void setBillDate(String billDate) {
        this.billDate = billDate;
    }

    public BigDecimal getBillAmount() {
        return billAmount;
    }

    public void setBillAmount(BigDecimal billAmount) {
        this.billAmount = billAmount;
    }

    public String getBillAbstract() {
        return billAbstract;
    }

    public void setBillAbstract(String billAbstract) {
        this.billAbstract = billAbstract;
    }

    public Long getSourceContractId() {
        return sourceContractId;
    }

    public void setSourceContractId(Long sourceContractId) {
        this.sourceContractId = sourceContractId;
    }

    public String getOrderTypeName() {
        return orderTypeName;
    }

    public void setOrderTypeName(String orderTypeName) {
        this.orderTypeName = orderTypeName;
    }

    public String getBillTypeName() {
        return billTypeName;
    }

    public void setBillTypeName(String billTypeName) {
        this.billTypeName = billTypeName;
    }
}
